<%@ page import="com.party.core.model.system.TargetType" %>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="../include/tag.jsp" %>
<!DOCTYPE html>
<html lang="zh">
<head>
    <title>
        ${member.id == null ? '查看' : '编辑'}用户信息
    </title>
    <%@include file="../include/commonFile.jsp" %>
    <script src="//api.map.baidu.com/api?v=2.0&ak=2izIwlMmDVH737ms8m4Y8uHsoxtEIR65"></script>
    <link rel="stylesheet" href="${ctx}/css/common/list.css">
    <link rel="stylesheet" href="${ctx}/css/ui/system/member/member_form.css">
    <script type="text/javascript" src="${ctxStatic}/typeahead/typeahead.bundle.js"></script>
    <style>
        .member-cell {
            display: -webkit-box;
            display: -webkit-flex;
            display: -moz-box;
            display: -ms-flexbox;
            display: flex;
            width: 100%;
            -webkit-box-align: center;
            -webkit-align-items: center;
            -moz-box-align: center;
            -ms-flex-align: center;
            align-items: center;
            -webkit-box-pack: start;
            -webkit-justify-content: flex-start;
            -moz-box-pack: start;
            -ms-flex-pack: start;
            justify-content: flex-start;
        }

        .member-cell .member-logo {
            display: inline-block;
            /*float: left;*/
            width: 30px;
            height: 30px;
            -webkit-border-radius: 50%;
            border-radius: 50%;
            line-height: 50px;
            -webkit-background-size: cover;
            background-size: cover;
            background-position: center;
            background-repeat: no-repeat;
        }

        .member-cell .member-name {
            -webkit-box-flex: 1;
            -moz-box-flex: 1;
            -ms-flex: 1;
            -webkit-flex: 1;
            flex: 1;
            line-height: 30px;
            padding-left: 5px;
            display: inline-block;
            text-align: left;
        }

        .member-cell .member-logo-img {
            width: 30px;
            height: 30px;
            -webkit-border-radius: 50%;
            border-radius: 50%;
        }

        .layui-form-label {
            width: 75px !important;
        }
        .post_site_K {
            width: 265px;
            height: 36px;
            border: 1px solid #d9d9d9;
            display: inline-block;
        }
    </style>
</head>
<body>
<!--头部-->
<%@include file="../include/header.jsp" %>
<div class="index-outside">
    <%@include file="../include/sidebar.jsp" %>
    <!--内容-->
    <section>
        <div class="section-main">
            <!-- 正文请写在这里 -->
            <div class="layui-tab layui-tab-brief" lay-filter="mem">
                <ul class="layui-tab-title">
                    <c:forEach items="${detailsTypes}" var="type">
                        <li ${detailType == type.key ? 'class="layui-this"':''}
                                data-type="${type.key}">${type.value}</li>
                    </c:forEach>
                </ul>
                <div class="layui-tab-content" id="memberInfo" style="display: block">
                    <%--个人信息---基本信息--%>
                    <div class="layui-tab-item layui-show">
                        <form id="myForm" class="layui-form mt20" method="post"
                              action="${ctx}/member/membermgmt/xzgs/saveOrUpdate.do">
                            <input type="hidden" name="id" value="${member.id}"/>
                            <input type="hidden" name="pmId" value="${pmId}"/>
                            <table>
                                <tr>
                                    <td colspan="3" align="center">
                                        <div class="layui-form-item">
                                            <div class="layui-inline">
                                                <span>----------------------------------------个人信息·基本信息----------------------------------</span>
                                            </div>
                                        </div>
                                    </td>
                                </tr>
                                <tr class="detail-content1">
                                    <td>
                                        <div class="layui-form-item">
                                            <div class="layui-inline">
                                                <label class="layui-form-label">姓名</label>
                                                <div class="layui-input-inline">
                                                    <input class="layui-input" name="realname" id="realname"
                                                           lay-verify="realname"
                                                           placeholder="姓名" value='${member.realname}'/>
                                                </div>
                                            </div>
                                        </div>
                                    </td>
                                    <td>
                                        <div class="layui-form-item">
                                            <div class="layui-inline">
                                                <label class="layui-form-label" style="width: 90px">性别</label>
                                                <div class="layui-input-inline">
                                                    <input type="radio" name="sex" value="1" title="男"
                                                    ${member.sex != null && member.sex == '1' ? 'checked="checked"' : ''}>
                                                    <input type="radio" name="sex" value="0" title="女"
                                                    ${member.sex == null || member.sex == '0' ? 'checked="checked"' : ''}>
                                                </div>
                                            </div>
                                        </div>
                                    </td>
                                    <td>
                                        <div class="layui-form-item">
                                            <div class="layui-inline">
                                                <label class="layui-form-label" style="width: 90px">婚姻情况</label>
                                                <div class="layui-input-inline">
                                                    <input type="radio" name="marital" value="已婚" title="已婚"
                                                    ${xzgsMemberInfo.customField.get("婚姻") != null
                                                            && xzgsMemberInfo.customField.get("婚姻") == "已婚" ? 'checked="checked"' : ''}>
                                                    <input type="radio" name="marital" value="未婚" title="未婚"
                                                    ${xzgsMemberInfo.customField.get("婚姻") == null ||
                                                            xzgsMemberInfo.customField.get("婚姻") == '未婚' ? 'checked="checked"' : ''}>
                                                </div>
                                            </div>
                                        </div>
                                    </td>
                                </tr>
                                <tr class="detail-content1">
                                    <td rowspan="2">
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">头像</label>
                                            <div class="cover-content">
                                                <input type="hidden" name="logo" id="pic" lay-verify="logo"
                                                       value="${(member.logo == null || empty member.logo) ? 'http://txzapp-10052192.image.myqcloud.com/1490783498894':member.logo}"/>
                                                <c:if test="${member == null || empty member.logo}">
                                        <span id="cover-img" class="round-img"
                                              style="background-image:url(http://txzapp-10052192.image.myqcloud.com/1490783498894)"></span>
                                                </c:if>
                                                <c:if test="${member != null && not empty member.logo}">
                                        <span id="cover-img" class="round-img"
                                              style="background-image:url('${member.logo}')"></span>
                                                </c:if>
                                                <a class="layui-btn layui-btn-danger" id="sel_pic_img1">+添加头像</a>
                                            </div>
                                        </div>
                                    </td>
                                    <td>
                                        <div class="layui-form-item">
                                            <div class="layui-inline">
                                                <label class="layui-form-label" style="width: 90px">年龄</label>
                                                <div class="layui-input-inline">
                                                    <input class="layui-input" name="age" id="age"
                                                           lay-verify="age"
                                                           placeholder="age"
                                                           value='${xzgsMemberInfo.customField.get("年龄")}'/>
                                                </div>
                                            </div>
                                        </div>
                                    </td>
                                    <td>
                                        <div class="layui-form-item">
                                            <div class="layui-inline">
                                                <label class="layui-form-label" style="width: 90px">子女情况</label>
                                                <div class="layui-input-inline">
                                                    <input class="layui-input" name="childDetail" id="childDetail"
                                                           placeholder="子女情况"
                                                           value="${xzgsMemberInfo.customField.get("子女情况")}">
                                                </div>
                                            </div>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <div class="layui-form-item">
                                            <div class="layui-inline">
                                                <label class="layui-form-label" style="width: 90px">手机号</label>
                                                <div class="layui-input-inline">
                                                    <input class="layui-input typeahead" id="phone" name="mobile"
                                                           placeholder="手机号"
                                                           lay-verify="mobile"
                                                           value="${member.mobile}">
                                                </div>
                                            </div>
                                        </div>
                                    </td>
                                    <td>
                                        <div class="layui-form-item">
                                            <div class="layui-inline">
                                                <label class="layui-form-label" style="width: 90px">户外兴趣</label>
                                                <div class="layui-input-inline">
                                                    <input class="layui-input" name="outHobby" id="outHobby"
                                                           placeholder="户外兴趣"
                                                           value="${xzgsMemberInfo.customField.get("户外兴趣")}">
                                                </div>
                                            </div>
                                        </div>
                                    </td>
                                </tr>
                                <tr class="detail-content1">
                                    <td rowspan="2">
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">海报</label>
                                            <div class="cover-content" id="poster">
                                            </div>
                                        </div>
                                    </td>
                                    <td>
                                        <div class="layui-form-item">
                                            <div class="layui-inline">
                                                <label class="layui-form-label" style="width: 90px">微信号</label>
                                                <div class="layui-input-inline">
                                                    <input class="layui-input" name="wechatNum" id="wechatNum"
                                                           placeholder="微信号"
                                                           value="${member.wechatNum}">
                                                </div>
                                            </div>
                                        </div>
                                    </td>
                                    <td>
                                        <div class="layui-form-item">
                                            <div class="layui-inline">
                                                <label class="layui-form-label" style="width: 90px">旅游</label>
                                                <div class="layui-input-inline">
                                                    <input class="layui-input" name="tourism" id="tourism"
                                                           placeholder="旅游"
                                                           value="${xzgsMemberInfo.customField.get("旅游")}">
                                                </div>
                                            </div>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">居住地址</label>
                                            <div class="layui-inline">
                                                <div class="layui-input-inline">
                                                    <select name="hCityId" id="cityId" lay-verify="city" lay-filter="city">
                                                        <option value="">选择城市</option>
                                                        <c:forEach var="city" items="${citys}">
                                                            <option value="${city.id}">${city.name}</option>
                                                        </c:forEach>
                                                    </select>
                                                </div>
                                                <div class="layui-input-inline">
                                                    <select name="hArea" lay-verify="area_select" id="areaSelect" lay-filter="area">
                                                        <option value="">选择区域</option>
                                                    </select>
                                                </div>
                                                <div class="layui-input-inline">
                                                    <input type="text" placeholder="填写具体地址" id="place" name="hPlace" value=""
                                                           class="layui-input"
                                                           lay-verify="place">
                                                </div>
                                            </div>
                                        </div>
                                    </td>
                                    <td>
                                        <div class="layui-form-item">
                                            <div class="layui-inline">
                                                <label class="layui-form-label" style="width: 90px">商业组织</label>
                                                <div class="layui-input-inline" style="width: 200px;height: 75px;">
                                        <textarea name="businessOrg" id="businessOrg"
                                                  placeholder="商业组织" style="margin: 0px; width: 192px; height: 59px;"
                                                  value="${xzgsMemberInfo.customField.get("商业组织")}">
                                            ${xzgsMemberInfo.customField.get("商业组织")}
                                        </textarea>
                                                </div>
                                            </div>
                                        </div>
                                    </td>
                                </tr>

                                <tr>
                                    <td colspan="3" align="center">
                                        <div class="layui-form-item">
                                            <div class="layui-inline">
                                                <span>----------------------------------------个人信息·公司信息----------------------------------</span>
                                            </div>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <div class="layui-form-item">
                                            <div class="layui-inline">
                                                <label class="layui-form-label">融资情况</label>
                                                <div class="layui-input-inline" id="busCorporate">
                                                    <input type="text" class="layui-input" name="busCorporate"
                                                           value="${xzgsMemberInfo.customField.get("融资情况")}"
                                                           placeholder="公司融资情况">
                                                </div>
                                            </div>
                                        </div>
                                    </td>
                                    <td>
                                        <div class="layui-form-item">
                                            <div class="layui-inline">
                                                <label class="layui-form-label">行业</label>
                                                <div class="layui-input-inline">
                                                    <select lay-verify="industryParent" lay-filter="industryParent" id="inParent">
                                                        <option value="">选择行业分类</option>
                                                        <c:forEach var="industry" items="${industries}">
                                                            <option value="${industry.id}" ${idParent == industry.id?'selected="selected"' : ''}>${industry.name}</option>
                                                        </c:forEach>
                                                    </select>
                                                </div>
                                                <div class="layui-input-inline">
                                                    <select name="industry" lay-verify="industry" id="industry">
                                                        <option value="">选择行业</option>
                                                    </select>
                                                </div>
                                            </div>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <div class="layui-form-item">
                                            <div class="layui-inline">
                                                <label class="layui-form-label">员工数量</label>
                                                <div class="layui-input-inline" id="busEmployeeNums">
                                                    <input type="text" class="layui-input" name="busEmployeeNums"
                                                           placeholder="公司员工数量" value="${xzgsMemberInfo.customField.get("员工规模")}">
                                                </div>
                                            </div>
                                        </div>
                                    </td>
                                    <td>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">公司地址</label>
                                            <div class="layui-inline">
                                                <div class="layui-input-inline">
                                                    <select name="cCityId" id="sCityId" lay-verify="sCityId" lay-filter="sCityId">
                                                        <option value="">选择城市</option>
                                                        <c:forEach var="city" items="${citys}">
                                                            <option value="${city.id}">${city.name}</option>
                                                        </c:forEach>
                                                    </select>
                                                </div>
                                                <div class="layui-input-inline">
                                                    <select name="cArea" lay-verify="area_select" id="sArea" lay-filter="sArea">
                                                        <option value="">选择区域</option>
                                                    </select>
                                                </div>
                                                <div class="layui-input-inline">
                                                    <input type="text" placeholder="填写具体地址" id="sPlace"
                                                           name="cPlace" value="" class="layui-input"  lay-verify="sPlace">
                                                </div>
                                            </div>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <div class="layui-form-item">
                                            <div class="layui-inline">
                                                <label class="layui-form-label">成立时间</label>
                                                <div class="layui-input-inline" id="companyCreateDate">
                                                    <input type="text" class="layui-input" name="companyCreateDate"
                                                           value="${xzgsMemberInfo.customField.get("成立时间")}"
                                                           placeholder="公司成立时间">
                                                </div>
                                            </div>
                                        </div>
                                    </td>
                                    <td>
                                        <div class="layui-form-item">
                                            <div class="layui-inline">
                                                <label class="layui-form-label">营收情况</label>
                                                <div class="layui-input-inline" id="busRevenue">
                                                    <input type="text" class="layui-input" name="busRevenue"
                                                           placeholder="公司营收情况"
                                                           value="${xzgsMemberInfo.customField.get("营收情况")}">
                                                </div>
                                            </div>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <div class="layui-form-item">
                                            <div class="layui-inline">
                                                <label class="layui-form-label">业务区域</label>
                                                <div class="layui-input-inline" id="busDevelopArea">
                                                    <input type="text" class="layui-input" name="busDevelopArea"
                                                           value="${xzgsMemberInfo.customField.get("关联行业")}"
                                                           placeholder="公司业务开展区域">
                                                </div>
                                            </div>
                                        </div>
                                    </td>
                                    <td>
                                        <div class="layui-form-item">
                                            <div class="layui-inline">
                                                <label class="layui-form-label">资产情况</label>
                                                <div class="layui-input-inline" id="companyAssets">
                                                    <input type="text" class="layui-input" name="companyAssets"
                                                           value="${xzgsMemberInfo.customField.get("资产评估")}"
                                                           placeholder="公司资产情况">
                                                </div>
                                            </div>
                                        </div>
                                    </td>

                                </tr>
                            </table>



                            <%--<div class="layui-form-item">--%>
                                <%--<div class="layui-inline">--%>
                                    <%--<label class="layui-form-label" style="width: 90px">子女</label>--%>
                                    <%--<div class="layui-input-inline">--%>
                                        <%--<input type="radio" name="child" value="有" title="有"--%>
                                        <%--${xzgsMemberInfo.customField.get("子女") != null--%>
                                                <%--&& xzgsMemberInfo.customField.get("子女") == "有" ? 'checked="checked"' : ''}>--%>
                                        <%--<input type="radio" name="child" value="无" title="无"--%>
                                        <%--${xzgsMemberInfo.customField.get("子女") == null ||--%>
                                                <%--xzgsMemberInfo.customField.get("子女") == '无' ? 'checked="checked"' : ''}>--%>
                                    <%--</div>--%>
                                <%--</div>--%>
                            <%--</div>--%>

                        </form>
                    </div>
                </div>
                <div class="layui-tab-content" id="xzgsInfo" style="display: none">
                    <table>
                        <tr>
                            <td colspan="3" align="center">
                                <span>------------------行知公社·相关信息------------------</span>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <label class="layui-form-label" style="width: 90px">加入时间</label>
                                        <div class="layui-input-inline">
                                            <input class="layui-input" id="joinTime" name="joinTime"
                                                   placeholder="加入时间" readonly
                                                   lay-verify="joinTime"
                                                   value="">
                                        </div>
                                    </div>
                                </div>
                            </td>
                            <td>
                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <label class="layui-form-label" style="width: 90px">所在分社</label>
                                        <div class="layui-input-inline">
                                            <input class="layui-input" id="partnerName" name="partnerName"
                                                   placeholder="所在分社" readonly
                                                   lay-verify="partnerName"
                                                   value="">
                                        </div>
                                    </div>
                                </div>
                            </td>
                            <td>
                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <label class="layui-form-label" style="width: 90px">分社职位</label>
                                        <div class="layui-input-inline">
                                            <input class="layui-input" id="leagueJob" name="leagueJob"
                                                   placeholder="分社职位" readonly
                                                   lay-verify="leagueJob"
                                                   value="${memberInfo.leagueJob}">
                                        </div>
                                    </div>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="3" align="center">
                                <span>------------------行知公社·数据信息------------------</span>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <span>个人行动力积分</span>
                                    </div>
                                </div>
                            </td>
                            <td>
                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <span>个人影响力积分</span>
                                    </div>
                                </div>
                            </td>
                            <td>
                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <span>户外积分</span>
                                    </div>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <label class="layui-form-label">积分总数</label>
                                        <div class="layui-input-inline">
                                            <input class="layui-input" id="memberActionForce" name="memberActionForce"
                                                   placeholder="积分总分" readonly
                                                   lay-verify="memberActionForce"
                                                   value="">
                                        </div>
                                    </div>
                                </div>
                            </td>
                            <td>
                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <label class="layui-form-label">积分总数</label>
                                        <div class="layui-input-inline">
                                            <input class="layui-input" id="memberInfluenceForce" name="memberInfluenceForce"
                                                   placeholder="积分总分" readonly
                                                   lay-verify="memberInfluenceForce"
                                                   value="">
                                        </div>
                                    </div>
                                </div>
                            </td>
                            <td>
                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <label class="layui-form-label">积分总数</label>
                                        <div class="layui-input-inline">
                                            <input class="layui-input" id="outdoorIntegral" name="outdoorIntegral"
                                                   placeholder="积分总分" readonly
                                                   lay-verify="outdoorIntegral"
                                                   value="">
                                        </div>
                                    </div>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <label class="layui-form-label">分社排名</label>
                                        <div class="layui-input-inline">
                                            <input class="layui-input" id="memberActionForceRank" name="memberActionForceRank"
                                                   placeholder="分社内排名" readonly
                                                   lay-verify="memberActionForceRank"
                                                   value="">
                                        </div>
                                    </div>
                                </div>
                            </td>
                            <td>
                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <label class="layui-form-label">分社排名</label>
                                        <div class="layui-input-inline">
                                            <input class="layui-input" id="memberInfluenceForceRank" name="memberInfluenceForceRank"
                                                   placeholder="分社内排名" readonly
                                                   lay-verify="memberInfluenceForceRank"
                                                   value="">
                                        </div>
                                    </div>
                                </div>
                            </td>
                            <td>
                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <label class="layui-form-label">分社排名</label>
                                        <div class="layui-input-inline">
                                            <input class="layui-input" id="outdoorIntegralRank" name="outdoorIntegralRank"
                                                   placeholder="分社内排名" readonly
                                                   lay-verify="outdoorIntegralRank"
                                                   value="">
                                        </div>
                                    </div>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <label class="layui-form-label">总社排名</label>
                                        <div class="layui-input-inline">
                                            <input class="layui-input" id="memberActionForceRankTotal"
                                                   name="memberActionForceRankTotal"
                                                   placeholder="总社排名" readonly
                                                   lay-verify="memberActionForceRankTotal"
                                                   value="">
                                        </div>
                                    </div>
                                </div>
                            </td>
                            <td>
                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <label class="layui-form-label">总社排名</label>
                                        <div class="layui-input-inline">
                                            <input class="layui-input" id="memberInfluenceForceRankTotal"
                                                   name="memberInfluenceForceRankTotal"
                                                   placeholder="总社排名" readonly
                                                   lay-verify="memberInfluenceForceRankTotal"
                                                   value="">
                                        </div>
                                    </div>
                                </div>
                            </td>
                            <td>
                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <label class="layui-form-label">总社排名</label>
                                        <div class="layui-input-inline">
                                            <input class="layui-input" id="outdoorIntegralRankTotal" name="outdoorIntegralRankTotal"
                                                   placeholder="总社排名" readonly
                                                   lay-verify="outdoorIntegralRankTotal"
                                                   value="">
                                        </div>
                                    </div>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <span>公益积分</span>
                                    </div>
                                </div>
                            </td>
                            <td>
                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <span>学习积分</span>
                                    </div>
                                </div>
                            </td>
                            <td>
                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <span>贡献积分</span>
                                    </div>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <label class="layui-form-label">积分总数</label>
                                        <div class="layui-input-inline">
                                            <input class="layui-input" id="publicWelfareIntegral" name="publicWelfareIntegral"
                                                   placeholder="积分总数" readonly
                                                   lay-verify="publicWelfareIntegral"
                                                   value="">
                                        </div>
                                    </div>
                                </div>
                            </td>
                            <td>
                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <label class="layui-form-label">积分总数</label>
                                        <div class="layui-input-inline">
                                            <input class="layui-input" id="studyIntegral" name="studyIntegral"
                                                   placeholder="积分总数" readonly
                                                   lay-verify="studyIntegral"
                                                   value="">
                                        </div>
                                    </div>
                                </div>
                            </td>
                            <td>
                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <label class="layui-form-label">积分总数</label>
                                        <div class="layui-input-inline">
                                            <input class="layui-input" id="devoteIntegral" name="devoteIntegral"
                                                   placeholder="积分总数" readonly
                                                   lay-verify="devoteIntegral"
                                                   value="">
                                        </div>
                                    </div>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <label class="layui-form-label">分社排名</label>
                                        <div class="layui-input-inline">
                                            <input class="layui-input" id="publicWelfareIntegralRank" name="publicWelfareIntegralRank"
                                                   placeholder="分社内部排名" readonly
                                                   lay-verify="publicWelfareIntegralRank"
                                                   value="">
                                        </div>
                                    </div>
                                </div>
                            </td>
                            <td>
                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <label class="layui-form-label">分社排名</label>
                                        <div class="layui-input-inline">
                                            <input class="layui-input" id="studyIntegralRank" name="studyIntegralRank"
                                                   placeholder="分社内部排名" readonly
                                                   lay-verify="studyIntegralRank"
                                                   value="">
                                        </div>
                                    </div>
                                </div>
                            </td>
                            <td>
                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <label class="layui-form-label">分社排名</label>
                                        <div class="layui-input-inline">
                                            <input class="layui-input" id="devoteIntegralRank" name="devoteIntegralRank"
                                                   placeholder="分社内部排名" readonly
                                                   lay-verify="devoteIntegralRank"
                                                   value="">
                                        </div>
                                    </div>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <label class="layui-form-label">总社排名</label>
                                        <div class="layui-input-inline">
                                            <input class="layui-input" id="publicWelfareIntegralRankTotal"
                                                   name="publicWelfareIntegralRankTotal"
                                                   placeholder="总社排名" readonly
                                                   lay-verify="publicWelfareIntegralRankTotal"
                                                   value="">
                                        </div>
                                    </div>
                                </div>
                            </td>
                            <td>
                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <label class="layui-form-label">总社排名</label>
                                        <div class="layui-input-inline">
                                            <input class="layui-input" id="studyIntegralRankTotal" name="studyIntegralRankTotal"
                                                   placeholder="总社排名" readonly
                                                   lay-verify="studyIntegralRankTotal"
                                                   value="">
                                        </div>
                                    </div>
                                </div>
                            </td>
                            <td>
                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <label class="layui-form-label">总社排名</label>
                                        <div class="layui-input-inline">
                                            <input class="layui-input" id="devoteIntegralRankTotal" name="devoteIntegralRankTotal"
                                                   placeholder="总社排名" readonly
                                                   lay-verify="devoteIntegralRankTotal"
                                                   value="">
                                        </div>
                                    </div>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <span>推荐积分</span>
                                    </div>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <label class="layui-form-label">积分总数</label>
                                        <div class="layui-input-inline">
                                            <input class="layui-input" id="recommendIntegral" name="recommendIntegral"
                                                   placeholder="积分总数" readonly
                                                   lay-verify="recommendIntegral"
                                                   value="">
                                        </div>
                                    </div>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <label class="layui-form-label">分社排名</label>
                                        <div class="layui-input-inline">
                                            <input class="layui-input" id="recommendIntegralRank" name="recommendIntegralRank"
                                                   placeholder="分社内部排名" readonly
                                                   lay-verify="recommendIntegralRank"
                                                   value="">
                                        </div>
                                    </div>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <label class="layui-form-label">总社排名</label>
                                        <div class="layui-input-inline">
                                            <input class="layui-input" id="recommendIntegralRankTotal"
                                                   name="recommendIntegralRankTotal"
                                                   placeholder="总社排名" readonly
                                                   lay-verify="recommendIntegralRankTotal"
                                                   value="">
                                        </div>
                                    </div>
                                </div>
                            </td>
                        </tr>
                    </table>
                </div>
                <div class="layui-tab-content" id="analysisInfo" style="display: none">
                    <div class="layui-form-item">
                        <span>一对一分析信息</span>
                    </div>
                    <%@include file="./questionForm.jsp" %>
                </div>
            </div>
        </div><!--底部-->
        <%@include file="../include/footer.jsp" %>
    </section>
</div>
<script>
    $(function () {
        $('#sel_pic_img1').click(function () {
            txz.openSelImg({
                min: 1,
                max: 1,
                info: '建议尺寸：120x120',
                type: '<%=TargetType.LOGO.getCode()%>',
                cb: function (imgs) {
                    $('#cover-img').css('background-image', 'url(' + imgs[0].path + ')');
                    $('#pic').val(imgs[0].path);
                }
            })
        })


        var form, laydate, element;
        var thMember = {}, thSel = false, thSel_tj = false, thMember_tj = {};
        var cityVal = "";
        layui.use(['form', 'laydate', 'element'], function () {
            form = layui.form, laydate = layui.laydate, element = layui.element;

            if ('${city}' != "") {
                loadCityData('${arParent}', '${city}');
                loadDistrictData('${city}', '${memberInfo.district}');
            }
            if ('${industryId}' != "") {
                loadIndustryData('${idParent}', '${industryId}');
            }

            element.on('tab(mem)', function (data) {
                if (data.index == 0) {
                    //个人信息
                    $('#memberInfo').css("display", "block");
                    $('#xzgsInfo').css("display", "none");
                    $('#analysisInfo').css("display", "none");
                } else if (data.index == 1) {
                    //行知公社信息
                    $('#memberInfo').css("display", "none");
                    $('#xzgsInfo').css("display", "block");
                    $('#analysisInfo').css("display", "none");
                    loadXzgsInfo()
                } else if (data.index == 2) {
                    //一对一分析信息
                    $('#memberInfo').css("display", "none");
                    $('#xzgsInfo').css("display", "none");
                    $('#analysisInfo').css("display", "block");
                }
            });


            //加载海报
            var imgPath = '${xzgsMemberInfo.customField.get("海报")}';
            if (imgPath) {
                var array = new Array();
                var values = imgPath.split(",");
                for (var j = 0; j < values.length; j++) {
                    var path = values[j];
                    array.push("<span img = '"+path+"'  class='cover-img' style='background-image:url("+path+")'>" + "</span>")
                }
                $("#poster").append(array)
            }



            $('#cityId').val('${memberInfo.hCityId}');
            $('#areaInput').val('${memberInfo.hArea}');
            $('#place').val('${memberInfo.hPlace}');

            $('#sCityId').val('${memberInfo.cCityId}');
            $('#sAreaInput').val('${memberInfo.cArea}');
            $('#sPlace').val('${memberInfo.cPlace}');

            var hCityName = $('#cityId option[value="${memberInfo.hCityId}"]')[0].label;
            var cCityName = $('#sCityId option[value="${memberInfo.cCityId}"]')[0].label;
            loadAreaData(hCityName,$('#areaInput').val())
            loadAreaData2(cCityName,$('#sAreaInput').val())

            // 城市
            form.on('select(province)', function (data) {
                $("#city").html("");
                var cityId = data.value;
                loadCityData(cityId);

                $("#district").html("");
                loadDistrictData(cityVal);
            });
            // 城市
            form.on('select(city2)', function (data) {
                $("#district").html("");
                var cityId = data.value;
                loadDistrictData(cityId);
            });

            // 行业
            form.on('select(industryParent)', function (data) {
                $("#industry").html("");
                var industryId = data.value;
                loadIndustryData(industryId, '');
            });
            var area = '${memberInfo.hArea}'
            // 城市
            form.on('select(city)', function (data) {
                var cityName = $('#cityId option[value="'+data.value+'"]')[0].label;
                loadAreaData(cityName,'');

            });

            form.on('select(sCityId)', function (data) {
                var cityName = $('#sCityId option[value="'+data.value+'"]')[0].label;
                loadAreaData2(cityName,'');
            });



            //自定义验证规则
            form.verify({
                realname: function (value) {
                    if (!value) {
                        return '姓名不能为空';
                    }
                    if (value.length > 40) {
                        return "姓名长度大于40";
                    }
                },
                mobile: function (value) {
                    if (!util.isValid(value)) {
                        return '请填写手机号';
                    }
                    if (value != "" && !util.checkMobile(value)) {
                        return "请填写正确格式的手机号码";
                    } else if (value != "" && util.checkMobile(value)) {
                        var memberId = $("input[name='id']").val();
                        var bl = false;
                        $.ajax({
                            type: 'POST',
                            async: false, // 使用同步的方法
                            data: {
                                mobile: value,
                                memberId: memberId
                            },
                            dataType: 'json',
                            success: function (result) {
                                var data = result.data;
                                bl = data;
                            },
                            url: "${ctx}/member/membermgmt/xzgs/checkPartnerUserMobile.do"
                        });

                        if (!bl) {
                            return "手机号已存在";
                        }
                    }
                },
                jobTitle: function (value) {
                    if (util.isValid(value) && value.length > 20) {
                        return "客户职务长度大于20";
                    }
                },
                leagueJob: function (value) {
                    if (util.isValid(value) && value.length > 20) {
                        return "社团职务长度大于20";
                    }
                },
                userSerial: function (value) {
                    if (util.isValid(value)) {
                        if (value.length > 10) {
                            return "编号长度大于10";
                        }
                    }
                },
                company: function (value) {
                    if (value.length > 40) {
                        return "公司名长度大于40";
                    }
                },
                email: function (value) {
                    if (util.isValid(value) && (!util.checkEmail(value))) {
                        return "请填写正确的的邮箱";
                    }
                    if (util.isValid(value) && value.length > 30) {
                        return "邮箱长度大于30";
                    }
                },
                address: function (value) {
                    if (util.isValid(value) && value.length > 50) {
                        return "详细地址长度大于50";
                    }
                },
                hobby: function (value) {
                    if (util.isValid(value) && value.length > 30) {
                        return "爱好长度大于30";
                    }
                },
                manifesto: function (value) {
                    if (util.isValid(value) && value.length > 50) {
                        return "宣言长度大于50";
                    }
                },
                synopsis: function (value) {
                    if (util.isValid(value) && value.length > 50) {
                        return "简介长度大于50";
                    }
                }
            });

            function loadAreaData2(cityName,area) {
                txz.ajaxRequest({
                    url:  '${ctx}/map/map/getAreaByCityName.do',
                    type: 'POST',
                    async: false, // 使用同步的方法
                    params:  {
                        "cityName": cityName
                    },
                    callBack:function (data) {
                        var str = '';
                        if (data.length > 0) {
                            for (var i = 0; i < data.length; i++) {
                                if (area && area == data[i].name) {
                                    str += "<option value = '" + data[i].name + "' selected='selected'>" + data[i].name + "</option>";
                                } else {
                                    str += "<option value = '" + data[i].name + "'>" + data[i].name + "</option>";
                                }
                            }
                            $("#sArea").html(str);
                            $("#sPlace").removeAttr("readonly");
                        } else {
                            str += "<option value = ''>选择区域</option>";
                            $("#sArea").html(str);
                        }
                        //刷新layForm
                        form.render('select');
                    }
                });
            }

            function loadAreaData(cityName,area) {
                var areaData = [];
                txz.ajaxRequest({
                    url:  '${ctx}/map/map/getAreaByCityName.do',
                    type: 'POST',
                    async: false, // 使用同步的方法
                    params:  {
                        "cityName": cityName
                    },
                    callBack:function (data) {
                        var str = '';
                        if (data.length > 0) {
                            for (var i = 0; i < data.length; i++) {
                                if (area && area == data[i].name) {
                                    str += "<option value = '" + data[i].name + "' selected='selected'>" + data[i].name + "</option>";
                                } else {
                                    str += "<option value = '" + data[i].name + "'>" + data[i].name + "</option>";
                                }
                            }
                            $("#areaSelect").html(str);
                            $("#place").removeAttr("readonly");
                        } else {
                            str += "<option value = ''>选择区域</option>";
                            $("#areaSelect").html(str);
                        }
                        //刷新layForm
                        form.render('select');
                    }
                });
            }

            function loadCityData(cityId, area) {
                $.ajax({
                    type: 'POST',
                    async: false, // 使用同步的方法
                    data: {
                        cityId: cityId
                    },
                    dataType: 'json',
                    success: function (res) {
                        var data = res
                        var array = new Array();
                        for (var i = 0; i < data.length; i++) {
                            if (i == 0) {
                                cityVal = data[i].id;
                            }
                            if (area == data[i].id) {
                                cityVal = data[i].id;
                                array.push("<option value = '" + data[i].id + "' selected='selected'>" + data[i].name + "</option>");
                            } else {
                                array.push("<option value = '" + data[i].id + "'>" + data[i].name + "</option>");
                            }
                        }
                        $("#city").append(array.join(""));
                        form.render('select');
                    },
                    url: "${ctx}/system/member/getCityByParentId.do"
                });
            }

            function loadDistrictData(city, area) {
                $.post("${ctx}/system/member/getCityByParentId.do", {
                    "cityId": city
                }, function (data) {
                    var array = new Array();
                    for (var i = 0; i < data.length; i++) {
                        if (area == data[i].id) {
                            array.push("<option value = '" + data[i].id + "' selected='selected'>" + data[i].name + "</option>");
                        } else {
                            array.push("<option value = '" + data[i].id + "'>" + data[i].name + "</option>");
                        }
                    }
                    $("#district").append(array.join(""));
                    form.render('select');
                });
            }


            function loadXzgsInfo() {
                $.post("${ctx}/member/membermgmt/xzgs/xzgsInfos.do", {
                    pmId: '${pmId}',
                    type: 1
                },function (date) {
                    if (date.success) {
                        // console.log(date);
                        $("#joinTime").val(date.data.createTime);
                        $("#partnerName").val(date.data.partnerName);

                        $("#devoteIntegral").val(date.data.devoteIntegral);
                        $("#devoteIntegralRank").val(date.data.devoteIntegralRank);
                        $("#devoteIntegralRankTotal").val(date.data.devoteIntegralRankTotal);

                        $("#memberActionForce").val(date.data.memberActionForce);
                        $("#memberActionForceRank").val(date.data.memberActionForceRank);
                        $("#memberActionForceRankTotal").val(date.data.memberActionForceRankTotal);

                        $("#memberInfluenceForce").val(date.data.memberInfluenceForce);
                        $("#memberInfluenceForceRank").val(date.data.memberInfluenceForceRank);
                        $("#memberInfluenceForceRankTotal").val(date.data.memberInfluenceForceRankTotal);

                        $("#outdoorIntegral").val(date.data.outdoorIntegral);
                        $("#outdoorIntegralRank").val(date.data.outdoorIntegralRank);
                        $("#outdoorIntegralRankTotal").val(date.data.outdoorIntegralRankTotal);

                        $("#publicWelfareIntegral").val(date.data.publicWelfareIntegral);
                        $("#publicWelfareIntegralRank").val(date.data.publicWelfareIntegralRank);
                        $("#publicWelfareIntegralRankTotal").val(date.data.publicWelfareIntegralRankTotal);

                        $("#recommendIntegral").val(date.data.recommendIntegral);
                        $("#recommendIntegralRank").val(date.data.recommendIntegralRank);
                        $("#recommendIntegralRankTotal").val(date.data.recommendIntegralRankTotal);

                        $("#studyIntegral").val(date.data.studyIntegral);
                        $("#studyIntegralRank").val(date.data.studyIntegralRank);
                        $("#studyIntegralRankTotal").val(date.data.studyIntegralRankTotal);
                    } else {
                        util.layerMsgSuccess('加载失败：'+date.description,{title: '通知', icon: 2, time: 2000})
                    }


                });
            }

            //监听提交
            form.on('submit(myForm)', function (data) {
                txz.submitObject(data.elem, function (callBack) {
                    var action = $("#myForm").attr("action");
                    $.post(action, $('#myForm').serialize(), function (res) {
                        typeof callBack === 'function' && callBack();
                        if (res.success) {
                            util.layerMsgSuccess("基本信息提交成功", function () {

                                var ref = '';
                                if (document.referrer.length > 0) {
                                    ref = document.referrer;
                                }
                                if (ref.length > 0) {
                                    if (ref.indexOf("pageNo") != -1) {
                                        location.href = ref;
                                    } else {
                                        ref = ref + "?pageNo=${pageNo}"
                                        location.href = ref;
                                    }
                                } else {
                                    location.href = "${ctx}/member/membermgmt/list.do";
                                }
                            });
                        } else {
                            util.layerMsgError(res.description)
                        }
                    });
                })
                return false;
            });

            $('#phone').typeahead({
                hint: false,
                highlight: true,
                minLength: 1
            }, {
                name: 'phone',
                display: 'mobile',
                async: true,
                templates: {
                    suggestion: function (member) {
                        return '<a href="javascript:void(0);"><span data-id="' + member.id + '" class="t-user-logo" style="background-image: url(' + member.logo
                            + '),url(${ctx}/image/def_user_logo.png)"></span><span class="t-user-name">' + (member.realname || '') + (member.mobile || '') + '</span></a>';
                    }
                },
                source: function (q, syn, aja) {
                    _findMember('phone', q, aja);
                }
            });

            $('#tjMemberMobile').typeahead({
                hint: false,
                highlight: true,
                minLength: 1
            }, {
                name: 'tjMemberMobile',
                display: 'tjMemberMobile',
                async: true,
                templates: {
                    suggestion: function (member) {
                        return '<a href="javascript:void(0);"><span data-id="' + member.id + '" class="t-user-logo" style="background-image: url(' + member.logo
                            + '),url(${ctx}/image/def_user_logo.png)"></span><span class="t-user-name">' + (member.realname || '') + (member.mobile || '') + '</span></a>';
                    }
                },
                source: function (q, syn, aja) {
                    _findPartnerMember('phone', q, aja);
                }
            });

            $('#tjMemberMobile').bind('typeahead:select', function (ev, suggestion) {
                thMember_tj = suggestion;
                thSel_tj = true;
                $(ev.currentTarget).blur();
            });
            $('#tjMemberMobile').blur(function () {
                if (thSel_tj) {
                    $('#tjMemberId').val(thMember_tj.id);
                    $('#tjMemberMobile').val(thMember_tj.mobile);

                } else {
                    if (thMember_tj.id) {
                        thMember_tj = {};
                        $('#tjMemberId').val("");
                        $('#tjMemberMobile').val("");
                    }
                }
                form.render();
                thSel_tj = false;
            });

            $('.typeahead').bind('typeahead:select', function (ev, suggestion) {
                thMember = suggestion;
                thSel = true;
                $(ev.currentTarget).blur();
            });
            $('.typeahead').blur(function () {
                if (thSel) {
                    _fillInfoById(thMember.id || '');
                } else {
                    if (thMember.id) {
                        thMember = {};
                        clearForm();
                    }
                }
                thSel = false;
            });

            function _findMember(type, q, cb) {
                $.ajax({
                    url: "${ctx}/system/member/findMemberByPhoneOrName.do",
                    type: "post",
                    dataType: "json",
                    data: {
                        property: type,
                        value: q
                    },
                    success: function (ret) {
                        cb(ret.data);
                    }
                });
            }

            // 联动行业
            function loadIndustryData(inParent, industryId) {
                var array = new Array();
                if (inParent == "") {
                    $("#industry").html("");
                    array.push("<option value=''>选择行业</option>");
                    $("#industry").append(array.join(""));
                    form.render('select');
                } else {
                    $.post("${ctx}/system/member/getIndustryByParentId.do", {
                        "industryId": inParent
                    }, function (data) {
                        for (var i = 0; i < data.length; i++) {
                            if (industryId == data[i].id) {
                                array.push("<option value = '" + data[i].id + "' selected='selected' >" + data[i].name + "</option>");
                            } else {
                                array.push("<option value = '" + data[i].id + "'>" + data[i].name + "</option>");
                            }
                        }
                        $("#industry").append(array.join(""));
                        form.render('select');
                    });
                }
            }

            function _findPartnerMember(type, q, cb) {
                $.ajax({
                    url: "${ctx}/system/member/findPartnerMemberByPhoneOrName.do",
                    type: "post",
                    dataType: "json",
                    data: {
                        property: type,
                        value: q,
                        pmId: $("input[name=pmId]").val()
                    },
                    success: function (ret) {
                        cb(ret.data);
                    }
                });
            }

            function _fillInfoById(id) {
                $.ajax({
                    url: '${ctx}/member/membermgmt/xzgs/getcMemberInfo.do',
                    type: 'POST',
                    dataType: 'JSON',
                    data: {
                        memberId: id
                    },
                    success: function (ret) {
                        var member = ret.data.member;
                        var cMemberInfo = ret.data.cMemberInfo;
                        var arParent = ret.data.arParent;


                        var logo = member.logo || '';
                        var realname = member.realname || '';
                        var phone = member.mobile || '';
                        var company = member.company || '';
                        var jobTitle = member.jobTitle || '';
                        var cityId = member.city || '';
                        var wechatNum = member.wechatNum || '';


                        $("#cover-img").css('background-image', "url('" + logo + "')");
                        $('#pic').val(logo);
                        $("#realname").val(realname);
                        $("#phone").val(phone);
                        $("#company").val(company);
                        $("#jobTitle").val(jobTitle);
                        $("#arParent").val(arParent);
                        $("input[name='id']").val(member.id);
                        $("#wechatNum").val(wechatNum);

                        $("input[name=sex][value=" + member.sex + "]").prop('checked', 'checked');


                        var hobby = cMemberInfo.hobby || '';
                        var synopsis = cMemberInfo.synopsis || '';
                        var manifesto = cMemberInfo.manifesto || '';
                        var address = cMemberInfo.address || '';
                        var district = cMemberInfo.district || '';
                        var email = cMemberInfo.email || '';
                        var userSerial = cMemberInfo.userSerial || '';
                        var leagueJob = cMemberInfo.leagueJob || '';

                        $("#hobby").val(hobby);
                        $("#synopsis").val(synopsis);
                        $("#manifesto").val(manifesto);
                        $("#address").val(address);
                        $("#email").val(email);
                        $("#userSerial").val(userSerial);
                        $("#leagueJob").val(leagueJob);
                        loadCityData(arParent, cityId);
                        loadDistrictData(cityId, district);

                        /*                    form.render('select');
                                            form.render('radio');*/
                        form.render();
                    }
                });
            }

            function clearForm() {
                $("input[name='id']").val("");
                $("#cover-img").css('background-image', "url('" + "http://txzapp-10052192.image.myqcloud.com/1490783498894" + "')");
                $('#pic').val("");
                $(".u-single-upload").show();

                $("#city").html("<option value=''>选择城市</option>");
                $("#industry").html("<option value=''>选择行业</option>");
                /*                form.render('select');
                                form.render('radio');*/
                form.render();
            }
        });


    })

    function openDialogShow(title, url, width, height, target) {
        layer.open({
            type: 2,
            area: [width, height],
            title: title,
            maxmin: false, // 开启最大化最小化按钮
            content: url,
            btn: ['关闭'],
            yes: function (index, layero) {
                setTimeout(function () {
                    top.layer.close(index);
                }, 100);// 延时0.1秒，对应360 7.1版本bug
            }
        });
    }
</script>
<script type="text/javascript">
    txz.initHeader({
        nav: [{
            name: '会员管理',
            href: '${ctx}/member/membermgmt/list.do'
        }, {
            name: '${member.id == null ? '添加' : '编辑'}用户',
            curr: true
        }],
        btns: [{
            name: '返回',
            href: 'javascript:history.back();',
            icon: 'back'
        }]
    });
</script>
</body>
</html>